Skip to main content

Class BaseSimulatedSensor<TUNIT>

A base class for simple simulated single-unit sensors

Assembly: Meadow.Foundation.dll​
View Source​
Declaration
public abstract class BaseSimulatedSensor<TUNIT> : ISimulatedSensor where TUNIT : struct, IComparable

Derived:
Meadow.Foundation.Sensors.SimulatedLightSensor

Implements:
Meadow.Peripherals.Sensors.ISimulatedSensor

Properties​

ZeroCondition​

Gets the zero condition for the snsor unit

View Source​
Declaration
public abstract TUNIT ZeroCondition { get; }

RandomWalkRange​

The upper/lower bound for a random walk

View Source​
Declaration
protected abstract double RandomWalkRange { get; }

SawtoothStepAmount​

The step amount for a sawtooth simulation

View Source​
Declaration
protected abstract double SawtoothStepAmount { get; }

SupportedBehaviors​

Gets an array of supported simulation behaviors for the sensor.

View Source​
Declaration
public SimulationBehavior[] SupportedBehaviors { get; }

ValueType​

Gets the type of the sensor's value.

View Source​
Declaration
public Type ValueType { get; }

UpdateInterval​

View Source​
Declaration
public TimeSpan UpdateInterval { get; }

IsSampling​

View Source​
Declaration
public bool IsSampling { get; }

CurrentCondition​

View Source​
Declaration
protected TUNIT? CurrentCondition { get; }

Methods​

IncrementCondition(TUNIT)​

Gets a condition incremented by a step value (used for interrupt value changes)

View Source​
Declaration
protected abstract TUNIT IncrementCondition(TUNIT currentCondition)
Returns​

<TUNIT>

Parameters​
TypeNameDescription
<TUNIT>currentConditionThe initial value to increment

DecrementCondition(TUNIT)​

Gets a condition decremented by a step value (used for interrupt value changes)

View Source​
Declaration
protected abstract TUNIT DecrementCondition(TUNIT currentCondition)
Returns​

<TUNIT>

Parameters​
TypeNameDescription
<TUNIT>currentConditionThe initial value to decrement

IncrementCondition(TUNIT, double)​

Gets a condition incremented by the provided root value amount

View Source​
Declaration
protected abstract TUNIT IncrementCondition(TUNIT currentCondition, double conditionDelta)
Returns​

<TUNIT>

Parameters​
TypeNameDescription
<TUNIT>currentConditionThe initial value to increment
System.DoubleconditionDeltaThe delta to increment by

DecrementCondition(TUNIT, double)​

Gets a condition decremented by the provided root value amount

View Source​
Declaration
protected abstract TUNIT DecrementCondition(TUNIT currentCondition, double conditionDelta)
Returns​

<TUNIT>

Parameters​
TypeNameDescription
<TUNIT>currentConditionThe initial value to decrement
System.DoubleconditionDeltaThe delta to decrement by

Read()​

View Source​
Declaration
public Task<TUNIT> Read()
Returns​

System.Threading.Tasks.Task<<TUNIT>>

StartUpdating(TimeSpan?)​

Starts updating the sensor value at the specified interval

View Source​
Declaration
public void StartUpdating(TimeSpan? updateInterval = null)
Parameters​
TypeName
System.Nullable<System.TimeSpan>updateInterval

StopUpdating()​

Stops updating the sensor

View Source​
Declaration
public void StopUpdating()

SetSensorValue(object)​

Sets the simulated value for the sensor.

View Source​
Declaration
public void SetSensorValue(object value)
Parameters​
TypeNameDescription
System.ObjectvalueThe value to set for the sensor.

StartSimulation(SimulationBehavior)​

Starts the simulation with the specified behavior.

View Source​
Declaration
public void StartSimulation(SimulationBehavior behavior)
Parameters​
TypeNameDescription
Meadow.Peripherals.Sensors.SimulationBehaviorbehaviorThe simulation behavior to start.

Events​

Updated​

View Source​
Declaration
public event EventHandler<IChangeResult<TUNIT>> Updated
Event Type​

System.EventHandler<Meadow.IChangeResult<<TUNIT>>>

Implements​

  • Meadow.Peripherals.Sensors.ISimulatedSensor